import numpy as np
import cv2
import LKtrack

cap = cv2.VideoCapture(0)
lk = LKtrack.LKTracker(cap)
lk.detect_points()
while True:
        #ret,im = cap.read()
        if len(lk.tracks) < 10:
                lk.detect_points()
        lk.track_points()
        lk.draw()
        cv2.imshow('video test',lk.image)
        key = cv2.waitKey(10)
        if key == 27:
                cv2.destroyAllWindows()
                cap.release()
                break
        if key == ord(' '):
                cv2.imwrite('save.jpg',im)
